package com.breakfast.fun.ui.home;

import com.breakfast.fun.data.entity.home.Home;
import com.breakfast.fun.data.entity.home.Version;
import com.breakfast.fun.data.entity.home.product.ProductDetail;
import com.breakfast.fun.data.entity.home.product.ProductState;
import com.breakfast.fun.util.Api;
import com.breakfast.fun.util.RxSchedulers;

import java.util.Map;

import retrofit2.http.FieldMap;
import rx.Observable;

/**
 * Created by hp on 2016/8/16.
 */
public class HomeModel implements HomeContract.Model {
    @Override
    public Observable<Home> getHomeModel(@FieldMap Map<String, String> map) {

        return Api.getInstance().service
                .getHomeModel(map)
                .compose(RxSchedulers.io_main());
    }

    @Override
    public Observable<Version> getVersionModel(@FieldMap Map<String, String> map) {
        return Api.getInstance().service
                .getVersionModel(map)
                .compose(RxSchedulers.io_main());
    }

    @Override
    public Observable<ProductDetail> getProductModel(@FieldMap Map<String, String> map) {
        return Api.getInstance().service
                .getProductDetailModel(map)
                .compose(RxSchedulers.io_main());
    }

    @Override
    public Observable<ProductState> getProductStateModel(@FieldMap Map<String, String> map) {
        return Api.getInstance().service
                .getProductStateModel(map)
                .compose(RxSchedulers.io_main());
    }

}
